//
//  GMDataHandleTool.m
//  News
//
//  Created by 雷国敏 on 16/9/12.
//  Copyright © 2016年 lieop. All rights reserved.
//

#import "GMDataHandleTool.h"

@implementation GMDataHandleTool
+(void)save:(NSString *)key data:(id)dataString
{
	
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setObject:dataString forKey:key];
	[ud synchronize];
}



+(void)remove:(NSString *)key
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud removeObjectForKey:key];
	[ud synchronize];
}


+(id)read:(NSString *)key
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud objectForKey:key];
}



+(void)saveObj:(NSString *)key data:obj{
	[GMDataHandleTool save:key data:[NSKeyedArchiver archivedDataWithRootObject:obj]];
}



+(id)readObj:(NSString *)key{
	return  [NSKeyedUnarchiver unarchiveObjectWithData:[GMDataHandleTool read:key]];
}
@end
